<?php
namespace Admin\Controller;

use Util\AccessController;


class BasketController extends AccessController {
    public function index() {
        $LS = Service('Basket', 'book');
        $files = C('ADMIN_BOOK_LS');
        $data = $LS->GetBasket($this->S('ID'),$files);
        $this->DATA = $data;
        $this->display();
    }

    /*
     * 加入篮子
     */
    public function AddAll() {
        $LS = Service('Basket', 'basket');
        $OK = $LS->AddAll($_POST['IDS'], $this->S('ID'));
        $this->ajaxReturn($OK);
    }

    /*
     * 篮子倒出
     */
    public function Del() {
        $LS = Service('Basket', 'basket');
        $OK = $LS->Del($_POST['IDS'], $this->S('ID'));
        $this->ajaxReturn($OK);
    }
    /*
     * 导入书柜
     */
    public function RUKU(){
        $LS = Service('Basket', 'basket');
        $OK = $LS->RUKU($_GET['SGCODE'], $this->S('ID'));
        $OK ? $this->success('导入成功'):$this->error('导入失败，书篮子中没有书籍');
    }
}